-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-EN-18:02.file                                           Errata Notice
                                                          The FreeBSD Project

Topic:          Version and security update of file(1) and libmagic(3)

Category:       contrib
Module:         file
Announced:      2018-03-07
Affects:        All supported versions of FreeBSD.
Corrected:      2018-02-05 08:20:11 UTC (stable/11, 11.1-STABLE)
                2018-03-07 06:04:25 UTC (releng/11.1, 11.1-RELEASE-p7)
                2018-02-05 08:50:34 UTC (stable/10, 10.4-STABLE)
                2018-03-07 06:04:25 UTC (releng/10.4, 10.4-RELEASE-p6)
                2018-03-07 06:04:25 UTC (releng/10.3, 10.3-RELEASE-p27)
CVE Name:       CVE-2017-1000249

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit
<URL:https://security.FreeBSD.org/>.

I.   Background

The file(1) utility attempts to classify file system objects based on
filesystem, magic number and language tests.

The libmagic(3) library provides most of the functionality of file(1) and
may be used by other applications.

II.  Problem Description

The file(1) utility contains a stack based buffer overflow when parsing
a specially crafted input file.

III. Impact

The issue lets an attacker overwrite a fixed 20 bytes stack buffer with
with a specially crafted .notes section in an ELF binary file.

IV.  Workaround

No workaround is available, but systems where file(1) and other applications
using libmagic(3) are never run on untrusted input are not vulnerable.

V.   Solution

Perform one of the following:

1) Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date.

2) To update your system via a binary patch:

Systems running a RELEASE version of FreeBSD on the i386 or amd64
platforms can be updated via the freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

3) To update your system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

[FreeBSD 10.3]
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-10.3.patch
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-10.3.patch.asc
# gpg --verify file-10.3.patch.asc

[FreeBSD 10.4]
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-10.4.patch
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-10.4.patch.asc
# gpg --verify file-10.4.patch.asc

[FreeBSD 11.1]
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-11.patch
# fetch https://security.FreeBSD.org/patches/EN-18:02/file-11.patch.asc
# gpg --verify file-11.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart all daemons that use the library, or reboot the system.

VI.  Correction details

The following list contains the correction revision numbers for each
affected branch.

Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/10/                                                        r328875
releng/10.3/                                                      r330569
releng/10.4/                                                      r330569
stable/11/                                                        r328874
releng/11.1/                                                      r330569
- -------------------------------------------------------------------------

To see which files were modified by a particular revision, run the
following command, replacing NNNNNN with the revision number, on a
machine with Subversion installed:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

<URL:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-1000249>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-EN-18:02.file.asc>
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAlqfhmJfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZD
MEU4NzhBRTVBRkU3ODgwMjhENjM1NUQzOTc5MkY0OUVBN0U1QzIACgkQ05eS9J6n
5cLAmg/+Ls59X/iLsmZiRvMiqfxI78P7FYuvTZ/6It0oaElmbswoaIDs3NF1c+II
lcKYwFyXPs4ge/9P4k4pz9bWN7IZcMlGuzDalWSpywF2y3I/6zCNOU2Xyzz4LLVx
wrLuWbTYqXFq6bgYsT8BBOANIadH5tjCfvO7DXOtRHyfUK5DJqsT+xMyv6R4Kncv
VnwjyBNkutT/kAkWYYdqJYLR7uhW2NmVk/57Un6lnGxsLUMgfL8jxzsTlGOa90q9
0fmGVTwkHxqfxqVSd9+lymISuuw4pg2Ar8bY0AKzMjhQTVMhEtLEsn0N+VbLg6Ns
6HCuPsYwDtGLJ8hd44JPCfbzxzOAW08flUwgu1U5E4e+sUIlKMTOhKxt/HrH+JFk
OyzLDytuv2364lMepThzO4++vWZkErxfa5uJFjjrax5w+WECyEddrUJG3HovOxMd
YXD/dBSulgxaAgVQLXhn1AI+BUR5rD59wsmi6rEYFDXhAfTxNtrHXp1vIoHiW4CO
a8jVPHfFcSuNzLfi+hE/QV8q2RWVOseYlOey0vme4h0upzi3HKQ8WPvUQUrHmDLw
D0Hmr6m9PpyoKFnh2UlM4RiEMf3RO4o4nkRHzPp40LPawzmOmilSmPwv/HasBe2z
X49GD/ortXLxn7UmGqjkIEApOo9me8lHxCYtODQC73BwZdFNrP4=
=PpWQ
-----END PGP SIGNATURE-----
